//package com.inspur.edp.bef.dtgenerator.core.rtgen.lcpgenerator.method;
//
//import com.inspur.edp.bef.rtgenerator.lcpgenerator.LcpClassGeneratorContext;
//import com.inspur.edp.caf.generator.baseInfo.TypeInfo;
//import com.inspur.edp.caf.generator.property.ClassPropertyGenerator;
//import com.inspur.edp.caf.generator.utils.ExpressionUtils;
//import com.inspur.edp.cef.api.attr.CefDataAttribute;
//import com.inspur.edp.cef.api.attr.ChildAttribute;
//import com.inspur.edp.cef.api.attr.RootAttribute;
//import com.inspur.edp.cef.entity.config.CefConfig;
//import com.inspur.edp.cef.entity.config.MgrConfig;
//import com.inspur.edp.cef.gencommon.ReflectionUtils;
//import com.inspur.edp.cef.gencommon.config.CefConfigUtils;
//import com.inspur.edp.cef.rtgenerator.utils.GeneratorUtil;
//import lombok.var;
//import org.eclipse.jdt.core.dom.*;
//
//import java.lang.reflect.Method;
//import java.util.ArrayList;
//import java.util.HashMap;
//import java.util.Map;
//
//public class LcpNodeRecordGenerator extends ClassPropertyGenerator
//{
//	private LcpClassGeneratorContext lcpGenContext;
//
//	public static LcpNodeRecordGenerator Create(LcpClassGeneratorContext lcpGenContext)
//	{
//		return new LcpNodeRecordGenerator(lcpGenContext);
//	}
//
//	private LcpNodeRecordGenerator(LcpClassGeneratorContext lcpContext)
//	{
//		lcpGenContext = lcpContext;
//	}
//	@Override
//	protected boolean isGetterOverride() {
//		return true;
//	}
//
//	@Override
//	protected boolean isSetterOverride() {
//		return true;
//	}
//
//	@Override
//	protected ArrayList<Modifier.ModifierKeyword> getSetterAccessModifier() {
//		return new java.util.ArrayList<Modifier.ModifierKeyword>(java.util.Arrays.asList(new Modifier.ModifierKeyword[] { Modifier.ModifierKeyword.PROTECTED_KEYWORD}));
//	}
//
//	@Override
//	protected java.util.ArrayList<Modifier.ModifierKeyword> getGetterAccessModifier()
//	{
//		return new java.util.ArrayList<Modifier.ModifierKeyword>(java.util.Arrays.asList(new Modifier.ModifierKeyword[] { Modifier.ModifierKeyword.PROTECTED_KEYWORD}));
//	}
//
//
//	@Override
//	protected TypeInfo getPropertyType()
//	{
//		TypeInfo typeInfo=new TypeInfo(HashMap.class.getTypeName());
//		typeInfo.setIsParameterizedType(true);
//		typeInfo.getArguments().add(new TypeInfo(String.class.getTypeName()));
//		typeInfo.getArguments().add(new TypeInfo(String.class.getTypeName()));
//		return typeInfo;
//	}
//
//	@Override
//	protected String getFieldName() {
//		return null;
//	}
//
//	@Override
//	protected String getPropertyName()
//	{
//		return "NodeRecord";
//	}
//
//	@Override
//	protected Block buildGetMethodBody() {
//		Block block=ast.newBlock();
//		buildNewHashMap(block);
//		try {
//			buildPutItems(block);
//		} catch (ClassNotFoundException e) {
//			e.printStackTrace();
//		}
//		buildReturnHashMap(block);
//		return block;
//	}
//
//	private void buildNewHashMap(Block block) {
//		VariableDeclarationFragment variableDeclarationFragment=ast.newVariableDeclarationFragment();
//
//		variableDeclarationFragment.setName(ast.newSimpleName("map"));
//		ClassInstanceCreation classInstanceCreation=ast.newClassInstanceCreation();
//		ParameterizedType parameterizedType=ast.newParameterizedType(new com.inspur.edp.caf.generator.baseInfo.TypeInfo(HashMap.class).getType(ast));
//		parameterizedType.typeArguments().add(new com.inspur.edp.caf.generator.baseInfo.TypeInfo(String.class).getType(ast));
//		parameterizedType.typeArguments().add(new com.inspur.edp.caf.generator.baseInfo.TypeInfo(String.class).getType(ast));
//		classInstanceCreation.setType(parameterizedType);
//		variableDeclarationFragment.setInitializer(classInstanceCreation);
//
//		VariableDeclarationStatement variableDeclarationStatement=ast.newVariableDeclarationStatement(variableDeclarationFragment);
//		ParameterizedType parameterizedType1=ast.newParameterizedType(new com.inspur.edp.caf.generator.baseInfo.TypeInfo(HashMap.class).getType(ast));
//		parameterizedType1.typeArguments().add(new com.inspur.edp.caf.generator.baseInfo.TypeInfo(String.class).getType(ast));
//		parameterizedType1.typeArguments().add(new com.inspur.edp.caf.generator.baseInfo.TypeInfo(String.class).getType(ast));
//		variableDeclarationStatement.setType(parameterizedType1);
//		block.statements().add(variableDeclarationStatement);
//	}
//
//	private void buildPutItems(Block block) throws ClassNotFoundException {
//		java.util.HashMap<String, String> dic = GetNodeIdDic();
//		for (Map.Entry<String,String> entry:dic.entrySet())
//		{
//			MethodInvocation methodInvocation=ast.newMethodInvocation();
//			methodInvocation.setName(ast.newSimpleName("put"));
//			methodInvocation.setExpression(ast.newSimpleName("map"));
//			methodInvocation.arguments().add(ExpressionUtils.getStringLiteral(ast,entry.getKey()));
//			if(entry.getValue()==null)
//			{
//				methodInvocation.arguments().add(ast.newNullLiteral());
//			}
//			else
//			{
//				methodInvocation.arguments().add(ExpressionUtils.getStringLiteral(ast,entry.getValue()));
//			}
//			block.statements().add(ast.newExpressionStatement(methodInvocation));
//		}
//	}
//
//
//	private void buildReturnHashMap(Block block) {
//		ReturnStatement returnStatement=ast.newReturnStatement();
//		returnStatement.setExpression(ast.newSimpleName("map"));
//		block.statements().add(returnStatement);
//	}
//
//
////	private void addMappingInfo(java.util.HashMap<String, String> dic, java.lang.Class type)
////	{
////		PropertyInfo[] info = type.GetProperties();
////		for (PropertyInfo p : info)
////		{
////			var proAttr = p.<ChildAttribute>GetCustomAttribute();
////			if (proAttr == null)
////			{
////				continue;
////			}
////			dic.put(proAttr.ObjectCode, proAttr.ID);
////			java.lang.Class t = proAttr.TargetInterfaceType;
////			//TODO: proAttr.TargetInterfaceType属性已废弃, 之前生成的设计时dll中此属性才有值
////			if (t == null)
////			{
////				var actionImpType = lcpGenContext.getProjContext().CurrentTypeInfo.EntityEntityTypeInfos[proAttr.ObjectCode].ActionImplType;
////				var cefDataAttr = actionImpType.<CefDataAttribute>GetCustomAttribute();
////				if (cefDataAttr != null)
////				{
////					t = cefDataAttr.DataInterfaceType;
////				}
////			}
////			AddMappingInfo(dic, t);
////		}
////	}
//
////	private void addExtendMappingInfo(java.util.HashMap<String, String> dic, java.lang.Class type)
////	{
////		PropertyInfo[] info = type.GetProperties();
////		for (var p : info)
////		{
////			var proAttr = p.<ExtendChildAttribute>GetCustomAttribute();
////			if (proAttr == null)
////			{
////				continue;
////			}
////			java.lang.Class t = proAttr.ObjectType;
////			AddMappingInfo(dic, t);
////		}
////	}
//
//	private java.util.HashMap<String, String> GetNodeIdDic() throws ClassNotFoundException {
//		java.util.HashMap<String, String> dic = new java.util.HashMap<String, String>();
//		//BEType获取路径
//		CefConfig cefConfig = lcpGenContext.getProjContext().getCefConfig();
//		MgrConfig mgrConfig = cefConfig.getMgrConfig();
//		String mgrClassName = mgrConfig.getImpClass();
//		String mgrAseemblyName = mgrConfig.getImpAssembly();
//		Class mgrType = null;
//		if(lcpGenContext.getProjContext().getCompileContext() == null){
//			mgrType = Class.forName(mgrClassName);
//		}else{
//			var compileContext = lcpGenContext.getProjContext().getCompileContext();
//			ArrayList<String> jarList = new ArrayList<String>(){
//				{
//					add(compileContext.getApiJarFileName());
//					add(compileContext.getCoreJarFileName());
//				}
//			};
//			mgrType = CefConfigUtils.getType(jarList, "",mgrClassName);
//		}
//
//		CefDataAttribute mgrAttr = (CefDataAttribute) ReflectionUtils.getAnnotation(mgrType,CefDataAttribute.class);// mgrType.<CefDataAttribute>GetCustomAttribute();
//		Class dataType = mgrAttr.dataInterfaceType();
//		RootAttribute rootAttr =  (RootAttribute) ReflectionUtils.getAnnotation(dataType,RootAttribute.class);
//		dic.put(rootAttr.objectCode(), rootAttr.id());
//
//		for (Method method:dataType.getMethods())
//		{
//			ChildAttribute childAttribute= (ChildAttribute) ReflectionUtils.getMethodAnnotation(method,ChildAttribute.class);
//			if (childAttribute == null)
//			{
//				continue;
//
//
//			}
//			dic.put(childAttribute.objectCode(),childAttribute.id());
//			//Java版临时注释：
//			//java.lang.Class t = childAttribute.TargetInterfaceType;
//		}
////		PropertyInfo[] info = dataType.GetProperties();
////		//基础的映射关系添加
////		for (PropertyInfo p : info)
////		{
////
////			dic.put(proAttr.ObjectCode, proAttr.ID);
////			java.lang.Class t = proAttr.TargetInterfaceType;
////			//TODO: proAttr.TargetInterfaceType属性已废弃, 之前生成的设计时dll中此属性才有值
////			if (t == null)
////			{
////				var actionImpType = lcpGenContext.getProjContext().CurrentTypeInfo.EntityEntityTypeInfos[proAttr.ObjectCode].ActionImplType;
////				var cefDataAttr = actionImpType.<CefDataAttribute>GetCustomAttribute();
////				if (cefDataAttr != null)
////				{
////					t = cefDataAttr.DataInterfaceType;
////				}
////			}
////			AddMappingInfo(dic, t);
////		}
////		//扩展的映射关系添加
////		for (var p : info)
////		{
////			var proAttr = p.<ExtendChildAttribute>GetCustomAttribute();
////			if (proAttr == null)
////			{
////				continue;
////			}
////			java.lang.Class t = proAttr.ObjectType;
////			AddMappingInfo(dic, t);
////			AddExtendMappingInfo(dic, t);
////		}
//
//		return dic;
//	}
//
////	private SyntaxNodeOrToken[] getExpress()
////	{
////		java.util.HashMap<String, String> dic = GetNodeIdDic();
////		java.util.ArrayList<SyntaxNodeOrToken> result = new java.util.ArrayList<SyntaxNodeOrToken>();
////		for(var key : dic.keySet())
////		{
////			SyntaxNodeOrToken token1 = null;
////			if (dic[key] == null)
////			{
////				token1 = SyntaxFactory.InitializerExpression(SyntaxKind.ComplexElementInitializerExpression, SyntaxFactory.<ExpressionSyntax>SeparatedList(new SyntaxNodeOrToken[]{ SyntaxFactory.LiteralExpression(SyntaxKind.StringLiteralExpression, SyntaxFactory.Literal(key)), SyntaxFactory.Token(SyntaxKind.CommaToken), SyntaxFactory.LiteralExpression(SyntaxKind.NullLiteralExpression)}));
////			}
////			else
////			{
////				token1 = SyntaxFactory.InitializerExpression(SyntaxKind.ComplexElementInitializerExpression, SyntaxFactory.<ExpressionSyntax>SeparatedList(new SyntaxNodeOrToken[]{ SyntaxFactory.LiteralExpression(SyntaxKind.StringLiteralExpression, SyntaxFactory.Literal(key)), SyntaxFactory.Token(SyntaxKind.CommaToken), SyntaxFactory.LiteralExpression(SyntaxKind.StringLiteralExpression, SyntaxFactory.Literal(dic[key]))}));
////			}
////			var token2 = SyntaxFactory.Token(SyntaxKind.CommaToken);
////			result.add(token1);
////			result.add(token2);
////		}
////		if (result.isEmpty())
////		{
////			return result.toArray(new SyntaxNodeOrToken[]{});
////		}
////		result.remove(result.size() - 1);
////		return result.toArray(new SyntaxNodeOrToken[]{});
////	}
//	@Override
//	protected boolean hasSetMethod()
//	{
//		return false;
//	}
//}